Display graph of the measured value

Latest update: April 2018

Overview

In this tutorial we will introduce the measured value function of FlashAir IoT Hub.

Using the measured value function, you can easily display measured values read from temperature sensors etc. in graphs.

How to operate the screen

The graph of the data of the latest 30 minutes is displayed in "Trigger > Measured value" on the screen.

Measurement value graph

Up to five measured values can be sent from FlashAir at the same time and are displayed on the graph, respectively.

Five graphs

Each graph can be given an arbitrary name so that you can see which value is displayed.

You can edit by clicking the label part.

Label
Label editing

You can download past data collectively with CSV file. (Up to 1000 newest)

CSV download
CSV file

Sending measured values

An example of sending measured values from FlashAir to FlashAir IoT Hub and displaying it on a graph will be introduced.

Please prepare to be able to connect from FlashAir to FlashAir IoT Hub in advance referring to Flow of use.

Sample script

The sample script bootscript.lua that can be downloaded from FlashAir IoT Hub has the following contents.

In this tutorial, only the processing related to measured values is explained. Other processing will be explained in other tutorials.

bootscript.lua

local iothub = require("iothub")

-- iothub.startPioUpload(0x03)
-- iothub.stopPioUpload()

local cnt = 0
while(1) do
  iothub.runJob()
  iothub.addMeasurement({10, 20, cnt})
  cnt = cnt + 1
  sleep(10000)
  collectgarbage("collect")
end
  • Line 1:
    FlashAir IoT Hub SDK's Lua script is loading.
    Functions for accessing FlashAir IoT Hub in Lua script are prepared in SDK, and processing for sending sensor data from FlashAir can be made easily.
  • Line 9:
    FlashAir IoT Hub SDK's iothub.addMesurement({x, y, ...}) is used to send the measured value to FlashAir IoT Hub.
    In line 9 we are sending three values.
  • Line 10:
    It sleeps for 10 seconds, and loops the process, so the measured value is sent to FlashAir IoT Hub every 10 seconds.

Execution result

Let's try to actually send measured values. Please put FlashAir in a card reader etc. where you can connect to the access point.

Update measurement graph

I think you can see that the graph of measured values is being updated little by little.

In this tutorial, we are sending sample values, but let's change it to your own use by referring to the sample script.